<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .center{
            text-align: center;
            border: 3px solid green;
        }
    </style>
</head>
<body>
    <h2>文本居中对齐</h2>
    <div class="center">
        <p>文本居中对齐</p>
    </div>
</body>
</html>